#pragma once
#include "DXAMLCommon.h"

struct Xcp_IDependencyObject;
struct ICoreServices;
class CMILMatrix;
class CFxCallbacks;
class CPopupRoot;
class XamlServiceProviderContext;
struct ICustomResourceLoader;
class CDataTemplate;
class CEventManager;
class CGeometryBuilder;
class CGlyphPathBuilder;
class ImageProvider;
class CLayoutManager;
class CRootVisual;
class CPrintRoot;
class CNameBuilder;
struct CoreSqmData;
class SurfaceCache;
struct IPALSurfaceUpdatePoolMap;
class CTransitionRoot;
class XamlNodeStreamCacheManager;
class CTextCore;
struct IVisualTreeHost;
class CWeakRefManager;
class VisualTree;
class HWWalk;
class CDeferredAnimationOperation;
struct IPLMListener;
struct DREQUEST;
struct XamlQualifiedObject;
class XamlCommonServiceProviderContext;
class CStyle;
class CSwapChainBackgroundPanel;
class CCompositorDirectManipulationViewport;
struct KnownProperty;
class CHardwareCompositor;
class CUIElement;
class CResourceDictionary;
class CTimeManager;
struct IPALClock;
struct _KnownTypesMetadata;
class CXcpValueStoreTable;
class CBaseValueStorage;
class CDeployment;
class CFocusManager;
class CInputManager;
class CMediaQueueManager;
struct IPALQueue;
class CCustomTypeFactory;
class CFrameVectorBuffer;
class CValueStore;
class AsyncImageFactory;
struct IPALWorkItemFactory;
class ImageTaskDispatcher;
struct IPALCriticalSection;
class ResourceManager;
class CDispatcherTimer;
class CRuntimeHost;
class CWindowRenderTarget;
class CHwndHostManager;
class CPermissionManager;
class CProxySettingsDictionary;
struct IPALDownloadRequest;
class CREATEPARAMETERS;
class CSL3Parser;
struct Xcp_IAutomationPeer;
class IXamlSchemaContext;
class CFxCallbacks;
class XamlCommonServiceProviderContext;
struct XamlPropertyToken;
class CDependencyObject;
class IXamlSchemaContext;
struct XamlQualifiedObject;
struct XamlTypeToken;
struct ICoreServices;
class CApplication;
class CBrush;
class CSolidColorBrush;
class CSurfaceImageSource;
class CVirtualSurfaceImageSource;
struct ICoreServicesSite;
struct IHwndHost;
struct IPALAsyncImageFactory;
struct IPALCrossDomainPolicyFactory;
struct IPALExecuteOnUIThread;
struct IPALGraphicsDeviceManager;
struct IValueStore;
struct IXcpDispatcher;
struct ICoreCompositorScheduler;
struct IPALPresentTarget;
struct ITickableFrameScheduler;
class CDataTemplate;
struct IManagedInteropObject;
struct IPALResourceManager;
struct KnownType;

#include "ICoreServices.h"
#include "CXcpList.h"
#include "CBaseValueStorage.h"
#include "CFrameVectorBuffer.h"
#include "_KnownTypesMetadata.h"
#include "IPALCriticalSection.h"
#include "EncodedPtr.h"
#include "CXcpDList.h"
#include "ICoreServices.h"
#include "CMILMatrix.h"
#include "CREATEPARAMETERS.h"

#include "CFxCallbacks.h"


typedef XINT32 ( * PFNGetpropertyMethod )(Xcp_IDependencyObject * pObject, XUINT32 cArgs, CValue * ppArgs, CValue * pResult);

class CCoreServices :
	public ICoreServices
{
public: 
	CCoreServices();
	~CCoreServices();
	XBOOL IsNewWalkEnabled();
	static HRESULT Create(XBOOL fPerformFullInitialize, struct ICoreServices * * ppCore);
	static struct KnownType * GetKnownTypes();
	virtual XUINT8 IsCoreReady();
	virtual XUINT32 Release();
	virtual XUINT32 AddRef();
	virtual HRESULT CreateErrorService(struct IErrorService * * ppObject);
	virtual HRESULT CheckUri(CXString * pstrRelativeUri, XUINT32 eUnsecureDownloadAction);
	virtual HRESULT UnsecureDownloadFromSite(CXString * pstrRelativeUri, 
		struct IPALUri * pAbsoluteUri, 
		struct IPALDownloadResponseCallback * pICallback, 
		XUINT32 eUnsecureDownloadAction, 
		struct IPALAbortableOperation * * ppIAbortableDownload, 
		struct IPALUri * pPreferredBaseUri, 
		struct RangeRequestData * pRangeRequestData);

	virtual HRESULT UnsecureDownloadFromSite(CXString * pstrRelativeUri, 
		struct IPALDownloadResponseCallback * pICallback, 
		unsigned int eUnsecureDownloadAction, 
		struct IPALAbortableOperation * * ppIAbortableDownload, 
		struct IPALUri * pPreferredBaseUri, 
		struct RangeRequestData * pRangeRequestData);

	virtual struct IXcpBrowserHost * GetBrowserHost();
	HRESULT RegisterFrameVectorBuffer(CFrameVectorBuffer *, void * *);
	HRESULT UnregisterFrameVectorBuffer(void *);
	static HRESULT CrackXmlns(XUINT32 cXmlns, const XCHAR * pXmlns, XCHAR * * ppClrNamespace, XCHAR * * ppAssembly);
	HRESULT ResetCustomAssemblyStore();
	virtual HRESULT RegisterScriptCallback(void * pControl, PFNScriptCallback  * pfnAsync, PFNScriptCallback  * pfnSync);
	virtual HRESULT ColorFromString(XUINT32, XCHAR * pString, XUINT32 * prgbResult);
	XUINT32 OfTypeByIndex(XUINT32 uiBaseTypeIndex, XUINT32 uiDerivedTypeIndex);
	void TrackMemory();
	virtual void ForceGCCollect();
	void StartMemoryTracking();
	virtual CClassInfo * GetClassInfoByName(XUINT32 cName, const XCHAR * pName);
	virtual CDependencyProperty * GetPropertyInfoByName(XUINT32 cName, const XCHAR * pName);
	CClassInfo * GetClassInfoByIndex(XUINT32 nIndex);
	virtual CDependencyProperty * GetContentProperty(CClassInfo * pClass);
	virtual CDependencyProperty * GetPropertyByName(CClassInfo * pClass, XUINT32 cName, const XCHAR * pName, XBOOL bUpperCamelCase);
	XUINT32 GetPropertyIndexByName(CClassInfo * pClass, XUINT32 cName, const XCHAR * pName, XUINT32 bUpperCamelCase);
	virtual CDependencyProperty * GetPropertyByIndex(XUINT32 nIndex);
	virtual CDependencyProperty * GetPropertyByIndex(CClassInfo * pClass, XUINT32 nIndex);
	virtual unsigned int GetDeclaringTypeIdByKnownPropertyId(XUINT32 nKnownPropertyId);
	CDependencyProperty * GetPropertyByIndexInline(XUINT32 nIndex);
	CDependencyProperty * GetPropertyByIndexInline(CClassInfo * pClass, XUINT32 nIndex);
	HRESULT GetPropertyTokenForIndex(XUINT32 nIndex, struct XamlPropertyToken * pPropertyToken);
	HRESULT GetTypeTokenForIndex(XUINT32 nIndex, struct XamlTypeToken * pTypeToken);
	HRESULT GetPropertyFromPropertyToken(struct XamlPropertyToken tokProperty, CDependencyProperty * * ppdp);
	virtual HRESULT GetDefaultInheritedPropertyValue(XUINT32 nUserIndex, CValue * pValue);
	virtual HRESULT GetDefaultTextBrush(CBrush * * ppBrush);
	virtual HRESULT GetTextSelectionGripperBrushes(CBrush * * ppFillBrush, CBrush * * ppStrokeBrush);
	virtual HRESULT GetSystemTextSelectionBackgroundBrush(CSolidColorBrush * * ppBrush);
	virtual HRESULT GetSystemTextSelectionForegroundBrush(CSolidColorBrush * * ppBrush);
	virtual HRESULT GetTransparentBrush(CBrush * * ppBrush);
	virtual CClassInfo * GetFirstConcreteDerivedClass(XUINT32 nBaseClassIndex);
	virtual HRESULT GetElementByName(XUINT32 cName, const XCHAR * pName, struct Xcp_IDependencyObject * pReferenceObject, struct Xcp_IDependencyObject * * ppIDO);
	virtual HRESULT CheckMethodCValueArguments(CClassInfo * pClass, XCHAR * pName, XUINT32 argCount, CValue * pValue, XBOOL bUpperCamelCase);
	virtual PFNGetpropertyMethod  * GetPropertyMethodByIndex(XUINT32 nMethodIndex);
	virtual XUINT32 GetThreadID();
	HRESULT ParsePropertyPath(CDependencyObject * * ppTarget, XUINT32 * pnPropertyIndex, XUINT32 cString, XCHAR * pString);

	HRESULT GetPropertyIndexForPropertyPath(CDependencyObject * pTarget, 
		XBOOL bParen, 
		struct XNAME * pNameClass, 
		CNameBuilder * pName, 
		struct XNAME * pNameProperty, 
		XUINT32 * pcProperty, 
		XCHAR * * ppProperty, 
		CClassInfo * pClass, 
		XUINT32 * pnPropertyIndex);

	virtual HRESULT CreateObject(CClassInfo * pClass, struct Xcp_IDependencyObject * pInDO, struct Xcp_IDependencyObject * * ppDO);
	virtual HRESULT CreateObject(CClassInfo * pClass, XUINT32 cString, XCHAR * pString, struct Xcp_IDependencyObject * * ppDO);
	HRESULT SetNamedObject(XUINT32 cName, XCHAR * pName, CDependencyObject * pNamescopeOwner, XBOOL bTemplateNamescope, void * hObject);
	CDependencyObject * GetNamedObject(XUINT32 cName, const XCHAR * pName, CDependencyObject * pNamescopeOwner, XBOOL bTemplateNamescope);
	HRESULT ClearNamedObject(XUINT32 cName, XCHAR * pName, CDependencyObject * pNamescopeOwner, void * hObject);
	HRESULT CreateNamescope(CDependencyObject * pNamescopeOwner, XBOOL bTemplateNamescope);
	HRESULT RemoveNamescope(CDependencyObject * pNamescopeOwner, XBOOL bTemplateNamescope);
	XBOOL HasRegisteredNames(CDependencyObject * pNamescopeOwner);
	HRESULT PostParseRegisterNames(CDependencyObject * pDependencyObject, XBOOL bPermanent);
	HRESULT RegisterNamescopeOwnerDefinitionName(CDependencyObject * pdoNameScopeOwner, CXString * pstrName);
	HRESULT UnregisterNamescopeOwnerDefinitionName(CDependencyObject * pdoNameScopeOwner);
	HRESULT GetNamescopeOwnerDefinitionName(CDependencyObject * pdoNameScopeOwner, CXString * * ppstrName, XBOOL * pbHasName);
	HRESULT SetBaseValueSource(CDependencyObject * pdo, CDependencyProperty * pdp, enum BaseValueSource baseValueSource);
	HRESULT GetAndRemoveBaseValueSource(CDependencyObject * pdo, CDependencyProperty * pdp, enum BaseValueSource * baseValueSource, XBOOL * bWasStored);
	HRESULT getColors(struct IValueStore * * ppStore);
	virtual void SetValueFromManaged(struct Xcp_IDependencyObject * pdo);
	virtual XBOOL IsSettingValueFromManaged(struct Xcp_IDependencyObject * pdo);
	virtual XBOOL HasActiveAnimations();
	virtual void SetAllowTransitionTargetCreation(XBOOL allow);
	virtual XBOOL IsAllowingTransitionTargetCreations();
	virtual HRESULT LoadXaml(XUINT32 cBuffer, XUINT8 * pBuffer, struct Xcp_IDependencyObject * * ppDependencyObject);
	virtual HRESULT GetResourceManager(struct IPALResourceManager * * ppResourceManager);

	virtual HRESULT ParseXaml(XUINT32 cBuffer, 
		XUINT8 * pBuffer, 
		XBOOL bCreatePermanentNamescope, 
		XBOOL bRequiresDefaultNamespace, 
		XBOOL bAllowEventHandlers, 
		struct Xcp_IDependencyObject * * ppDependencyObject, 
		XUINT32 cSourceAssemblyName, 
		XCHAR * pSourceAssemblyName, 
		XBOOL bExpandTemplatesDuringParse, 
		XUINT32 cXamlResourceUriStringCount, 
		XCHAR * pXamlResourceUriString, 
		XBOOL bIsBinaryContent);
	
	virtual HRESULT ParseXamlWithEventRoot(XUINT32 cBuffer, 
		XUINT8 * pBuffer, 
		XBOOL bCreatePermanentNamescope, 
		XBOOL bRequireDefaultNamespace, 
		XBOOL bAllowEventHandlers, 
		struct Xcp_IDependencyObject * pEventRoot, 
		struct Xcp_IDependencyObject * * ppDependencyObject, 
		struct Xcp_IDependencyObject * pTemplatedParent, 
		XBOOL bRegisterNamesInTemplateNamescope, 
		struct IValueStore * pResourcesForOriginalScope, 
		struct IPALUri * pXamlResourceUri, 
		XUINT32 cSourceAssemblyName, 
		XCHAR * pSourceAssemblyName, 
		XBOOL bExpandTemplatesDuringParse, 
		XBOOL bIsBinaryContent);

	virtual HRESULT ParseXamlWithExistingFrameworkRoot(XUINT32 cBuffer, 
		XUINT8 * pBuffer, 
		XBOOL bCreatePermanentNamescope, 
		struct Xcp_IDependencyObject * m_pExistingFrameworkRoot, 
		XUINT32 cAssemblyStrCount, 
		XCHAR * pAssemblyStr, 
		XUINT32 cXamlResourceUriStrCount, 
		XCHAR * pXamlResourceUriStr, 
		struct Xcp_IDependencyObject * * ppDependencyObject, 
		XBOOL bAllowCoreExistingFrameworkRoot);

	virtual HRESULT ResetVisualTree();
	virtual HRESULT putVisualRoot(struct Xcp_IDependencyObject * pDependencyObject);
	virtual struct Xcp_IDependencyObject * getVisualRoot();
	virtual struct Xcp_IDependencyObject * getRootScrollViewer();
	struct IVisualTreeHost * GetVisualTreeHost(CDependencyObject * pObject);
	virtual void NotifyMEforOutputProtection(struct Xcp_IDependencyObject * pRoot);
	HRESULT AddChildForUpdate(CDependencyObject * pChild);
	HRESULT RemoveChildForUpdate(CDependencyObject * pChild);
	HRESULT GetWindowSizeInDIPs(CDependencyObject * pObject, struct XSIZEF * pSize);
	HRESULT GetWindowSizeInDIPs(CDependencyObject * pObject, struct XSIZE * pSize);
	virtual HRESULT getErrorService(struct IErrorService * * ppErrorService);
	virtual HRESULT ReportUnhandledError(HRESULT errorXR);
	virtual HRESULT putBackgroundColor(XUINT32 uBackgroundColor);
	virtual HRESULT putEnableRedrawRegions(XINT32 fEnableRedrawRegions);
	virtual XINT32 getEnableRedrawRegions();
	virtual void BeginWatch();
	virtual void KeepWatch(XINT32 flag);
	virtual XINT32 CheckWatch(XINT32 flag);
	virtual HRESULT NWDrawMainTree(struct ICoreRenderTarget * pIRenderTarget, XBOOL fForceRedraw, XBOOL needsToReleaseHardwareResources, struct XRECT_WH * prcDirtyRect);
	HRESULT NWDrawTree(HWWalk * pHWWalk, struct ICoreRenderTarget * pIRenderTarget, VisualTree * pVisualTree, XUINT32 uBackgroundColor, XBOOL forceRedraw, XBOOL needsToReleaseHardwareResources, struct XRECT_WH * prcDirtyRect);
	virtual HRESULT Tick(XBOOL tickForDrawing);
	virtual HRESULT CallPerFrameCallback(XFLOAT time);
	HRESULT EnqueueSurfaceContentsLostEvent();
	virtual HRESULT RaiseQueuedSurfaceContentsLostEvent();
	virtual HRESULT AddSurfaceImageSource(CSurfaceImageSource * pItem);
	virtual HRESULT RemoveSurfaceImageSource(CSurfaceImageSource * pItem);
	virtual HRESULT AddVirtualSurfaceImageSource(CVirtualSurfaceImageSource * pItem);
	virtual HRESULT RemoveVirtualSurfaceImageSource(CVirtualSurfaceImageSource * pItem);
	virtual HRESULT VirtualSurfaceImageSourcePerFrameWork(const struct XRECTF_RB * pWindowBounds);
	virtual HRESULT HitTest(struct XPOINTF ptHit, struct Xcp_IDependencyObject * pHitTestRoot, struct Xcp_IDependencyObject * * ppVisualHit, HWND hWindowID);
	virtual HRESULT HitTestHyperlinkFromRichTextBox(struct XPOINTF ptHit, struct Xcp_IDependencyObject * pHyperlinkContainer, struct Xcp_IDependencyObject * * ppHyperlink);
	virtual HRESULT ProcessInput(struct InputMessage * pMessage, XINT32 * fHandled, HWND hWindowID);
	virtual HRESULT ProcessDragDrop(struct DragMsg *, XBOOL bRequireMouseMoveForDragOver, XBOOL bRaiseDragEventsSync, XINT32 * pHandled);
	virtual HRESULT ProcessDragDrop(struct DragMsg * pMessage, XINT32 * pHandled);
	void SetUseCustomDragEvents(XBOOL useCustomDragEvents);
	virtual HRESULT ProcessTouchInteractionCallback(struct Xcp_IDependencyObject * pElement, struct TouchInteractionMsg * pMessage);
	HRESULT GetAdjustedPopupRootForElement(CDependencyObject * pObject, CPopupRoot * * ppPopupRoot);
	HRESULT IsObjectAnActiveRootVisual(struct Xcp_IDependencyObject * pObject, XBOOL * pIsActiveRoot);
	HRESULT IsObjectAnActivePublicRootVisual(struct Xcp_IDependencyObject * pObject, XBOOL * pIsActiveRoot);
	HRESULT IsObjectAnActivePopupRoot(struct Xcp_IDependencyObject * pObject, XBOOL * pIsActivePopupRoot);
	CRootVisual * GetMainRootVisual();
	CPopupRoot * GetMainPopupRoot();
	HRESULT StartApplication(CApplication * pApplication);
	HRESULT RaisePendingLoadedRequests();
	HRESULT GetDefaultContentPresenterTemplate(CDataTemplate * * ppTemplate);
	CTimeManager * GetTimeManager();
	CFocusManager * GetMainFocusManager();
	virtual struct Xcp_IDependencyObject * GetFocusedElement();
	virtual struct Xcp_IAutomationPeer * GetFocusedAutomationPeer();
	virtual void SetFocusedAutomationPeer(struct Xcp_IAutomationPeer * pAP);
	CInputManager * GetMainInputManager();
	CEventManager * GetEventManager();
	CWeakRefManager * GetWeakRefManager();
	CPrintRoot * GetPrintRoot();
	XBOOL IsPrinting();
	void SetIsPrinting(XBOOL val);
	CTransitionRoot * GetTransitionRoot();
	void SetCustomResourceLoader(struct ICustomResourceLoader * pResourceLoader);
	struct ICustomResourceLoader * GetCustomResourceLoader();
	virtual void RegisterHostSite(struct IXcpHostSite * pHostSite);
	virtual struct IXcpHostSite * GetHostSite();
	virtual void UnregisterHostSite();
	virtual HRESULT RegisterBrowserHost(struct IXcpBrowserHost * pBrowserHost);
	virtual HRESULT UnregisterBrowserHost();
	virtual HRESULT RegisterDownloadSite(struct ICoreServicesSite * pSite);
	virtual void UnregisterDownloadSite();
	virtual HRESULT UnsecureHTTPRequestFromSite(struct IPALDownloadRequest * pRequest, struct IPALAbortableOperation * * ppIAbortableDownload);
	virtual HRESULT GetSystemGlyphTypefaces(struct Xcp_IDependencyObject * * ppDo);
	XBOOL IsCLRFrameworkInitialized();
	void SetCLRFrameworkInitialized(XBOOL fCLRInitialized);
	virtual void CLR_UseCustomAppDomain(void * pRawAppDomain);
	virtual XBOOL CLR_IsAppDomainWithoutSecuritySandboxAllowed();
	virtual HRESULT CLR_Startup(XBOOL fIsXap);
	virtual void CLR_Shutdown();
	virtual HRESULT CLR_AsyncReleaseNativeObject(struct IManagedInteropObject * pObj);
	void CLR_CleanupNativePeers();
	virtual HRESULT CLR_FireEvent(struct Xcp_IDependencyObject * pSender, struct Xcp_IDependencyObject * pe, XCHAR * pName, XUINT32 flags);
	virtual XCHAR * CLR_GetNamespace(struct Xcp_IDependencyObject * pDO);
	virtual HRESULT CLR_GetScriptableObjectID(XCHAR * pName, XUINT32 * pID);
	virtual HRESULT CLR_GetScriptableObjectFromID(XUINT32 Id, void * * ppScriptObject);
	virtual HRESULT ShouldFireEvent(struct Xcp_IDependencyObject * pSender, struct Xcp_IDependencyObject * pe, const CXString * pstrName, XINT32 flags, XINT32 * pfShouldFire);
	virtual HRESULT DeploymentComplete();
	virtual HRESULT ApplicationStartupEventComplete();
	virtual HRESULT StartDeploymentTree(struct Xcp_IDependencyObject * pDeploymentObject);
	virtual HRESULT CreateSourceDownloadEventArgs(XFLOAT fValue, struct Xcp_IDependencyObject * * ppEventArgs);
	virtual HRESULT CreateValueStore(struct IValueStore * * ppValueStore, XINT32 bObjectBase);
	virtual HRESULT EnsureResourceDictionaryUriCache(struct IValueStore * * ppRDUriCache);
	virtual HRESULT EnumToString(CDependencyProperty * pdp, CValue * pValue);
	virtual XUINT32 GetIdentity();
	virtual HRESULT SetCurrentApplication(CApplication * pApplication);
	void NWSetWindowRenderTarget(struct ICoreWindowRenderTarget *);
	virtual struct ICoreWindowRenderTarget * NWGetWindowRenderTarget();
	void SetDirtyState(XBOOL fDirtyState);
	XBOOL GetDirtyState();
	XBOOL InRenderWalk();
	virtual void DebugSetZoom(XINT32 nPixelX, XINT32 nPixelY, XFLOAT rZoomFactor);
	void DbgEnableThreadingAssert(XBOOL fEnable);
	XINT32 DbgIsThreadingAssertEnabled();
	virtual XFLOAT GetZoomScale();
	float GetZoomScaleInline();
	virtual void FireAccessibilityAction(struct Xcp_IDependencyObject * pObject);
	virtual void SetCanTabOutOfPlugin(XBOOL bCanTabOutOfPlugin);
	virtual XBOOL IsPluginFocused();
	virtual void ClearFocus();
	virtual HRESULT CreatePolicyFileFactory(struct IPALCrossDomainPolicyFactory * * ppPolicyFactory);
	HRESULT UIAClientsAreListening(enum UIAXcp::APAutomationEvents eAutomationEvent);
	HRESULT UIARaiseAutomationEvent(struct Xcp_IAutomationPeer * pAP, enum UIAXcp::APAutomationEvents eAutomationEvent);
	HRESULT UIARaiseAutomationPropertyChangedEvent(struct Xcp_IAutomationPeer * pAP, enum UIAXcp::APAutomationProperties eAutomationProperty, CValue * oldValue, CValue * newValue);
	XUINT32 GetNextRuntimeId();
	void ResetGeometryBuilder(XUINT32 nIndex);
	HRESULT GetGeometryBuilder(XUINT32 nIndex, CGeometryBuilder * * ppBuilder, XBOOL fGetPathGeometryBuilder);
	HRESULT GetGlyphPathBuilder(CGlyphPathBuilder * * ppBuilder);
	HRESULT GetTextCore(CTextCore * * ppTextCore);
	CLayoutManager * GetMainLayoutManager();
	CUIElement * GetLastLayoutExceptionElement();
	void SetLastLayoutExceptionElement(CUIElement * pElement);
	HRESULT AddDownloadRequest(struct IPALDownloadRequest * pDownloadRequest, struct IPALAbortableOperation * * ppIAbortableDownload, struct IPALUri * pPreferredBaseUri);
	HRESULT ProcessDownloadRequests(XINT32 bClear);
	HRESULT RemoveDownloadRequest(struct DREQUEST * pRequest);
	void ReportAsyncErrorToBrowserHost();
	virtual HRESULT CreateMediaQueue(struct IMediaQueueClient * pClient, struct IMediaQueue * * ppQueue);
	HRESULT ProcessMediaEvents(XBOOL fShuttingDown);
	virtual XUINT32 GetApplicationMajorVersion();
	virtual XINT32 GetDrmApplicationIdentity(struct IPALMemory * * ppAppId);
	HRESULT SetWantsRendering(XBOOL value);
	HRESULT RegisterDragDropEvents();
	CDeployment * GetDeployment();
	HRESULT GetCustomTypeFactory(CCustomTypeFactory * *);
	HRESULT ClearCustomTypeFactoryCache();
	HRESULT RefreshXamlSchemaContext(XBOOL bRefreshOnlyXmlnsDefinitions);
	static HRESULT CallbackEventListener(struct Xcp_IDependencyObject * pSender, struct Xcp_IDependencyObject * pEventArgs);
	HRESULT GetBaseUri(CValue *);
	HRESULT GetSecurityUri(CValue *);
	struct IPALUri * GetBaseUriNoRef();
	HRESULT GetDomainURL(CXString * *, enum DomainUrlOptions::Value);
	HRESULT GetFullClassName(CXString * pstrClass, CXString * * ppstrFullName);
	virtual HRESULT CreateCompositorScheduler(struct IPALGraphicsDeviceManager * pIGraphicsDeviceManager, struct ICoreCompositorScheduler * * ppICompositorScheduler);
	virtual HRESULT CreateUIThreadScheduler(struct IXcpDispatcher * pIDispatcher, struct ICoreCompositorScheduler * pICompositorScheduler, struct ITickableFrameScheduler * * ppUIThreadScheduler);
	virtual HRESULT CreateWindowRenderTarget(struct IPALGraphicsDeviceManager * pIGraphicsDeviceManager, struct ICoreCompositorScheduler * pICompositorScheduler, struct IPALPresentTarget * pIInitialPresentTarget);
	HRESULT RegisterPLMListener(struct IPLMListener * pPLMListener);
	HRESULT UnregisterPLMListener(struct IPLMListener * pPLMListener);
	HRESULT OnSuspend();
	HRESULT OnResume();
	static HRESULT OnBackgroundResourceTimeout(struct Xcp_IDependencyObject * pSender, struct Xcp_IDependencyObject * pEventArgs);
	virtual XUINT8 IsNativeHosted();
	HRESULT GetFullClassNameByIndex(XUINT32 nClassIndex, CXString * * pstrFullName);
	XBOOL IsInResetVisualTree();
	virtual HRESULT ForceIncreaseQuota(XUINT64 quotaSize);
	virtual XBOOL ShouldForceIncreaseQuota();
	unsigned int GetClickCount();
	void SetClickCount(XUINT32);
	XBOOL IsSameButton(enum MessageMap);
	XBOOL IsWithinTime(XUINT64);
	XBOOL IsWithinRect(struct XPOINTF);
	void SetLastClickButton(enum MessageMap);
	void SetLastClickTime(XUINT64);
	void SetLastClickPosition(struct XPOINTF);
	HRESULT SetSystemColorsResourcesXaml(XUINT32 cSystemColorsResourcesXaml, XCHAR * pSystemColorsResourcesXaml);
	HRESULT GetSystemColorsResources(CResourceDictionary * * ppSystemColorsResources);
	void SetThemeResources(CResourceDictionary * pThemeResources);
	CResourceDictionary * GetThemeResources();
	CXString * GetHighContrastThemeName();
	CXString * GetRequestedThemeName();
	HRESULT SetHighContrastThemeName(CXString * pHighContrastThemeName);
	HRESULT SetRequestedThemeName(CXString * pRequestedThemeName);
	virtual HRESULT ExecuteOnUIThread(struct IPALExecuteOnUIThread * pExecutor, XBOOL fAllowReentrancy);
	CHwndHostManager * GetHwndHostManager();
	virtual XBOOL IsHwndHostingEnabled();
	virtual HRESULT RegisterHwndHost(struct IHwndHost * pHwndHost);
	virtual HRESULT UnregisterHwndHost(struct IHwndHost * pHwndHost);
	virtual HRESULT ResizeHwndHostsToFitPlugin();
	virtual HRESULT TranslateAcceleratorW(void * pMsg, XBOOL & bHandled);
	virtual HRESULT GetHwndHostedAt(struct XPOINTF pt, void * * pHwnd, struct XPOINTF * pptHwndOrigin);
	HRESULT InvokeTickCallbackOnHwndHosts();
	HRESULT UpdateDirtyState();
	virtual HRESULT GetImageFactory(struct IPALAsyncImageFactory * * ppFactory);
	HRESULT GetImageProvider(ImageProvider * * ppImageProvider);
	SurfaceCache * GetSurfaceCache();
	HRESULT ClearImageCaches();
	HRESULT LookupApplicationResource(XUINT32 cKey, XCHAR * pKey, CDependencyObject * * ppObject, XBOOL localOnly, XBOOL isImplicitStyle, XBOOL isImplicitDataTemplate, XBOOL shouldCheckThemeResources);
	virtual XBOOL IsRightAngleRotated();
	virtual void SetDisplayRotation(enum DisplayRotation displayRotation);
	XBOOL UseSeparateSwapChainsForRootChildren(CSwapChainBackgroundPanel * pSCBP);
	void IncrementMediaElementCount();
	void DecrementMediaElementCount();
	struct CoreSqmData * GetSqmData();
	void SetGraphicsInteropUsage(enum SqmGraphicsInteropType::InteropType interopType);
	HRESULT EnsureSurfaceUpdatePoolMap();
	struct IPALSurfaceUpdatePoolMap * GetSurfaceUpdatePoolMapNoRef();
	virtual void SetSizeChangedNotification(XUINT32 value, XUINT32 applicationViewState);
	virtual XBOOL GetWindowVisibility();
	virtual HRESULT SetWindowVisibility(XBOOL value, XBOOL isStartingUp);
	XUINT32 IsRenderEnabled();
	HRESULT EnableRender(XBOOL enable);
private: 
	XBOOL HasSwapChainBackground(CSwapChainBackgroundPanel * pSCBP);
	XBOOL TreeHasMediaElements();
	HWWalk * GetHWWalk();
	XUINT32 GetBackgroundColor(CUIElement * pRootVisual);
	HRESULT FindSCBP(CSwapChainBackgroundPanel * * ppSCBP);
	HRESULT LookupThemeResource(XUINT32 cKey, XCHAR * pKey, CDependencyObject * * ppValue);
	HRESULT ResetState();
	XUINT32  StringCompareWithCamelCase(XUINT32 cName, const XCHAR * pName, XUINT32 cMatchName, const XCHAR * pMatchName, XBOOL bUpperCamelCase);
	HRESULT GetValueStoreForOwner(CDependencyObject * pNamescopeOwner, XBOOL bTemplateNamescope, XBOOL bCreate, struct IValueStore * * ppValueStore);
	void DeinitCallbacks();
	HRESULT GetAppVersionFromManifest(XUINT32 * puMajorVersion, XUINT32 * puMinorVersion, XUINT32 * puBuildNumber, XUINT32 * puRevisionNumber);
	HRESULT DoesNamescopeOwnerMatchName(XUINT32 cchName, const XCHAR * pName, CDependencyObject * pNamescopeOwner, XBOOL * pbNameMatched);
	void ClearNamescopeOwnerDefinitionNames();
	HRESULT AddManagedTypeInformationToSchemaContext();
	HRESULT GetDirectManipulationChanges(xvector<IObject *> & oldDirectManipulationViewports, xvector<CCompositorDirectManipulationViewport *> & newDirectManipulationViewports, XBOOL fResubmitActiveViewports, CSwapChainBackgroundPanel * pSCBP, XBOOL * pViewportsChanged);
	HRESULT SubmitDirectManipulationChangesToCompositor(CHardwareCompositor * pHardwareCompositor, const xvector<IObject *> & oldDirectManipulationViewports, const xvector<CCompositorDirectManipulationViewport *> & newDirectManipulationViewports);
	HRESULT RenderWalk(HWWalk * pHWWalk, struct ICoreRenderTarget * pIRenderTarget, VisualTree * pVisualTree, CSwapChainBackgroundPanel * pSCBP, XUINT32 uBackgroundColor,   XBOOL forceRedraw, XBOOL needsToReleaseHardwareResources, XBOOL isOverdrawHeatMapEnabled, XBOOL forceAllSlotsDirty);

	HRESULT SubmitPrimitiveCompositionCommands(HWWalk * pHWWalk, struct ICoreRenderTarget * pIRenderTarget, CUIElement * pVisualRoot, CSwapChainBackgroundPanel * pSCBP, struct IPALClock * pClock, XFLOAT rFrameStartTime, struct XRECT_WH * pDirtyRect, XUINT32 uBackgroundColor, const xvector<IObject *> & oldDirectManipulationViewports, const xvector<CCompositorDirectManipulationViewport *> & newDirectManipulationViewports);


	HRESULT SubmitRenderCommandsToCompositor(CHardwareCompositor * pHardwareCompositor, HWWalk * pHWWalk, struct ICoreRenderTarget * pIRenderTarget, struct IPALClock * pClock, XFLOAT rFrameStartTime, CMILMatrix * pDCompTransform, CTimeManager * pTimeManagerClone, const struct XRECTF_WH & backBufferSize, const xvector<IObject *> & oldDirectManipulationViewports, const xvector<CCompositorDirectManipulationViewport *> & newDirectManipulationViewports, xchainedmap<CUIElement *,IObject *> * pMapUIElementToCompositorContent, XUINT32 zIndex);


	HRESULT CheckForLostSurfaceContent();
	HRESULT HandleVirtualSurfaceImageSourceLostResources(HWWalk * pHWWalk);
	HRESULT UpdateSqmData();
public: 
	enum DisplayRotation GetDisplayRotation();
	static void GetDisplayOrientationTransform(enum DisplayRotation displayRotation, XFLOAT renderTargetWidth, XFLOAT renderTargetHeight, CMILMatrix * pDisplayOrientationTransform);
	virtual HRESULT GetAppVersion(XUINT32 * puMajorVersion, XUINT32 * puMinorVersion, XUINT32 * puBuildNumber, XUINT32 * puRevisionNumber);
	virtual HRESULT SetAppVersion(XUINT32 uMajorVersion, XUINT32 uMinorVersion);
	void SetTimeManager(CTimeManager * pTimeManager);

	class CXFNode
	{
		CXFNode();
		~CXFNode();
		CXFNode * m_pPrev;
		XUINT32 m_nMatrix;
		CMILMatrix m_aMatrix[16];
	};

private: 
	HRESULT GetFullClassNameFromClassInfo(CClassInfo * pClassInfo, CXString * * ppstrFullName);
	HRESULT EnsureWorkItemFactory();
public: 
	HRESULT FlushDeferredAnimationOperationQueue(XBOOL bDoDeferredOperation);
	HRESULT QueueDeferredAnimationOperation(CDeferredAnimationOperation * pDeferredAnimationOperation);
	void SetCurrentParser(CSL3Parser *);
	CSL3Parser * GetCurrentParser();
	virtual XBOOL IsShuttingDown();
	virtual void SetShuttingDown(XBOOL bState);
	XBOOL IsDestoryingCoreServices();
	HRESULT GetPropertyUsingCurrentOWContext(xshared_ptr<CXString> spFullyQualifiedName, struct XamlPropertyToken & rtokProperty);
	void SetCurrentTypeConverterContext(const xshared_ptr<XamlServiceProviderContext> & spServiceProviderContext);
	void GetCurrentTypeConverterContext(xshared_ptr<XamlServiceProviderContext> & rspServiceProviderContext);
	virtual XBOOL IsInDesignMode();
	virtual void SetIsInDesignMode(XBOOL bState);
	XBOOL InvisibleHitTestMode();
	void SetInvisibleHitTestMode(XBOOL bState);
	XBOOL GetCompleteTimelinesAutomatically();
	void SetCompleteTimelinesAutomatically(XBOOL state);
	HRESULT InitializeSchemaContext();
	xshared_ptr<IXamlSchemaContext> GetSchemaContext();
	HRESULT GetXamlNodeStreamCacheManager(xshared_ptr<XamlNodeStreamCacheManager> & spXamlNodeStreamCacheManager);
	HRESULT AddAssemblyToSchemaContext(IXamlSchemaContext *, struct XamlAssemblyToken, XCHAR * , XUINT32);
	HRESULT GetTypeNamespaceIdFromName(const CXString & strTypeNamespace, XUINT32 & uiTypeNamespaceId);
	HRESULT GetTypeNamespaceNameFromId(XUINT32 uiNamespaceId, CXString * * ppstrTypeNamespace);
	HRESULT GetAllTypeNamespaces(const CXString * pstrXmlNamespace, const XUINT32 * * ppuiTypeNamespaceIds, XUINT32 * pcTypeNamespaceIds);
	XBOOL IsVisibilityToggled();
	void SetVisibilityToggled(XBOOL bState);
	HRESULT SetHasImplicitDataTemplate(XUINT32 cTypeFullName, XCHAR * pTypeFullName);
	XBOOL HasImplicitDataTemplate(XUINT32 cTypeFullName, XCHAR * pTypeFullName);
	XBOOL HasAnyImplicitDataTemplate();
	HRESULT RegisterVisualTreeHost(struct IVisualTreeHost * pHost);
	HRESULT UnregisterVisualTreeHost(struct IVisualTreeHost * pHost);
	XBOOL HasVisualTreeHosts();
	virtual HRESULT CheckForRenderThreadFailureAndRecover();
	HRESULT InvalidateImplicitStylesOnRoots(CResourceDictionary * pOldResources);
	HRESULT UpdateImplicitStylesOnRoots(CStyle * pOldStyle, CStyle * pNewStyle);



	HRESULT ShimGetResourcePropertyBagRaw(const xshared_ptr<CXString> & spKeyString, xref_ptr<IPALUri> spBaseUri, const xshared_ptr<XamlQualifiedObject> & spObject, const xshared_ptr<XamlCommonServiceProviderContext> & spServiceProviderContext, xshared_ptr<xpairlist<xshared_ptr<CXString>,xshared_ptr<CXString> > > & spPropertyBag);

	XUINT32 m_uFrameNumber;
	void * m_pRawAppDomain;
	struct Xcp_IDependencyObject * m_pdoInSetValueFromManaged;
	XBOOL m_allowTransitionTargetsToBeCreated;
private: 
	EncodedPtr<_KnownTypesMetadata> s_pKnownTypesMetadata;
	struct _KnownTypesMetadata * m_pKnownTypesMeta;
	HRESULT InitializeKnownInfo();
	HRESULT CleanupKnownInfo();
	HRESULT BuildKnownColors();
	HRESULT InitializeTypes();
	HRESULT RegisterKnownClass(const struct KnownType & knownType);
	HRESULT RegisterKnownProperty(const struct KnownProperty & knownProperty);
	HRESULT RegisterPropertyHelper(CClassInfo * pClass, CDependencyProperty * pProperty, struct Property & prop, XCHAR * pString, XUINT32 cchScratchString);
	HRESULT CreatePropertyArray();
	HRESULT CreateRenderPropertyArray();
	XUINT32 m_cRef;
	XUINT32 m_nThreadID;
	CXcpValueStoreTable * m_pNamed;
	CXcpValueStoreTable * m_pTemplateNamescopes;
	xchainedmap<CDependencyObject *,CXString *> m_pNameScopeOwnerDefinitionNameMap;  
	CXcpList<CBaseValueStorage> * m_pBaseValueStorageOverflow;
	CBaseValueStorage * m_pBaseValueStoragePrimary;
	struct IValueStore * m_pCustomAssemblies;
	xshared_ptr<IXamlSchemaContext> m_spXamlSchemaContext; 
	xshared_ptr<XamlNodeStreamCacheManager> m_spXamlNodeStreamCacheManager;  
	VisualTree * m_pMainVisualTree;
	CUIElement * m_pOfflineProgressUI;
	CDeployment * m_pDeploymentTree;
	CTimeManager * m_pTimeManager;
	CWeakRefManager * m_pWeakRefManager;
	CFocusManager * m_pFocusManager;
	CEventManager * m_pEventManager;
	CInputManager * m_pInputManager;
	struct Xcp_IAutomationPeer * m_pFocusedAutomationPeer;
	CMediaQueueManager * m_pmqm;
	struct IXcpHostSite * m_pHostSite;
	struct IXcpBrowserHost * m_pBrowserHost;
	struct ICoreServicesSite * m_pSite;
	XINT32 m_bBuilderReady[2];

	CGeometryBuilder * m_pBuilder[2];

	CGlyphPathBuilder * m_pGlyphPathBuilder;
	CTextCore * m_pTextCore;
	CBrush * m_pDefaultTextBrush;
	CBrush * m_pTextSelectionGripperFillBrush;
	CBrush * m_pTextSelectionGripperStrokeBrush;
	CSolidColorBrush * m_pTextSelectionBackgroundBrush;
	CSolidColorBrush * m_pTextSelectionForegroundBrush;
	CBrush * m_pTransparentBrush;
	XUINT32 m_uBackgroundColor;
	struct IPALQueue * m_preqQueue;
	XINT32 m_fWatch;
	XBOOL m_bFrameworkCallbacksSet;
	XUINT8 m_fIsCoreReady;
	XUINT32 m_objIdentity;
	CCoreServices * m_pDrawReentrancyCheck;
	CDataTemplate * m_pDefaultContentPresenterTemplate;
	struct IValueStore * m_pResourceDictionaryUriCache;
	XUINT8 m_bProcessingDownloads;
	struct IPALQueue * m_pNativeManagedPeerQ;
	struct IPALQueue * m_pDeferredAnimationOperationQueue;
	XBOOL m_isMainTreeLoading;
	XBOOL m_fWantsRenderingEvent;
	XBOOL m_fSurfaceContentsLostEnqueued;
	XBOOL m_lastRenderWalkUsedSeparateSwapChains;
	XUINT32 m_countMediaElements;
	CXcpList<CSurfaceImageSource> * m_pAllSurfaceImageSources;
	CXcpList<CVirtualSurfaceImageSource> * m_pAllVirtualSurfaceImageSources;
	XUINT32 m_iClickCount;
	enum MessageMap m_mmClickCountLastClickButton;
	XUINT64 m_iClickCountLastClickTime;
	struct XPOINTF m_ptClickCountLastClickPos;
	XUINT64 m_iClickCountTimeThreshold;
	struct XPOINT m_ptClickCountPosThreshold;
	XUINT32 m_uAppMajorVersion;
	XUINT32 m_uAppMinorVersion;
	XUINT32 m_uForcedAppMajorVersion;
	XUINT32 m_uForcedAppMinorVersion;
	CXcpDList<CFrameVectorBuffer> m_secondVectorBufferList;  
	EncodedPtr<IPALCriticalSection> s_pcsCLRStartup;
	XUINT32 s_cCLRStartupRef;
	CCustomTypeFactory * m_pCustomTypeFactory;
	XUINT32 m_uRuntimeId;
	XBOOL m_fDbgLogTextures;
	XBOOL m_fCLRInitialized;
	CSL3Parser * m_pCurrentParser;
	xweak_ptr<XamlServiceProviderContext> m_spCurrentServiceProviderContext;
	xvector<CDependencyObject *> m_rgpChildrenForUpdate;
	XBOOL m_bClipboardAccessPromptShown;
	XBOOL m_bHasClipboardAccess;
	XBOOL m_bInResetVisualTree;
	XBOOL m_bIsShuttingDown;
	XBOOL m_bIsInDesignMode;
	XBOOL m_bVisibilityToggled;
	XBOOL m_bInvisibleHitTestMode;
	XBOOL m_completeTimelinesAutomatically;
	XBOOL m_bIsDestroyingCoreServices;
	CFxCallbacks m_fx;  
	CValueStore * m_pImplicitDataTemplateTypeStore;
	xvector<IVisualTreeHost *> * m_pVisualTreeHostList;
	XBOOL m_useCustomDragEvents;
	struct ICustomResourceLoader * m_pCustomResourceLoader;
	AsyncImageFactory * m_pImageFactory;
	ImageProvider * m_pImageProvider;
	ImageTaskDispatcher * m_pImageTaskDispatcher;
	struct IPALWorkItemFactory * m_pWorkItemFactory;
	ResourceManager * m_pResourceManager;
	void * m_frameworkContext;
	struct IPALMemory * m_pAppVerificationId;
	struct IPALCriticalSection * m_pAppVerificationIdLock;
	CUIElement * m_pLastLayoutExceptionElement;
	xvector<IPLMListener *> m_plmListeners; 
	struct CoreSqmData * m_pSqmData;
	enum DisplayRotation m_displayRotation;
	XUINT32 m_displayRotationChanged:1;
	XUINT32 m_zoomScaleChanged:1;
	struct IPALSurfaceUpdatePoolMap * m_pSurfaceUpdatePoolMap;
	XUINT32 m_windowSizeChanged;
	XUINT32 m_windowViewStateOnResize;
	XBOOL m_isWindowVisible;
	XBOOL m_isRenderEnabled;
	XBOOL m_renderStateChanged;
	XBOOL m_isSuspended;
	CDispatcherTimer * m_pBackgroundResourceTimer;
public: 
	CFxCallbacks * Fx();
	void SetFxCallbacks(CFxCallbacks * pfx);
	void SetFrameworkContext(void * context);
	void * GetFrameworkContext();
	XUINT32 m_cInheritedPropGenerationCounter;
	XUINT32 m_cIsRightToLeftGenerationCounter;
	CRuntimeHost * m_pRuntimeHost;
	XUINT32 m_cTrackingInterval;
	XUINT64 m_cMaxAllowedMemoryincrease;
	XUINT8 m_State;
	XUINT64 m_lPrvMemCount;
	XINT32 m_fEnableDirtyRegionsDisplay;
	CWindowRenderTarget * m_pNWWindowRenderTarget;
	XBOOL m_fEnableNewDirectManipulation;
	XBOOL m_fDirtyState;
	XBOOL m_fInRenderWalk;
	XBOOL m_fDbgEnableThreadingAssert;
	XFLOAT m_rZoomScale;
	XBOOL m_fPrinting;
	XBOOL m_bShouldForceIncreaseQuota;
	XBOOL m_fIsXapExploded;
	CXString * m_pSystemColorsResourcesXaml;
	CResourceDictionary * m_pSystemColorsResources;
	CResourceDictionary * m_pThemeResources;
	CXString * m_pHighContrastThemeName;
	CXString * m_pRequestedThemeName;
	CHwndHostManager * m_pHwndHostManager;
	CPermissionManager * m_pPermissionManager;
	CProxySettingsDictionary * m_pProxyPermissionsNode;
	XBOOL m_fFirstFrame;


};



//static_assert(sizeof(CCoreServices) == 0x5e4,"ad");
